import { useState,useEffect } from "react";
import axios from "axios";

export function useGetTabList(){
    const  [tabList,setTabList] = useState([]); //data.tabs
    useEffect(()=>{
        async function getList(){
            //axios获取数据
          const res =await axios.get('http://localhost:3004/tabs');
          setTabList(res.data)
        }
        getList()
    
    },[])
    
    return {
        tabList,
        setTabList
    }
}

export function useGetList(){
    const  [dataList,setDataList] = useState([]); //data.tabs
     useEffect(()=>{
        async function getList(){
            //axios获取数据
          const res =await axios.get('http://localhost:3004/list');
          setDataList(res.data)
        }
        getList()
    
     },[])
    
    return {
        dataList,
        setDataList
    }
}